import cv2 as cv

cameraCapture = cv.VideoCapture(0)
cv.namedWindow('Test camera') 
success, frame = cameraCapture.read()

while success:
    if cv.waitKey(1) == 27:
        break
    cv.imshow('Test camera', frame)
    success, frame = cameraCapture.read()
    
cameraCapture.release()